﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TRINHTUNGLAM.OOP.EX2
{
    class MODEL
    {
        /// <summary>
        /// Thuc thi tinh toan cong tru nhan chia
        /// </summary>
        /// <param name="objEntity"></param>
        /// <param name="opt">opt= 0: Cong opt =1 :Tru</param>
        /// <returns></returns>
        public double Caculator(Entity objEntity, short opt )
        {
            //1.Tuong minh bien nhan ket qua
            double kq = 0;
            //2.Thuc thi tinh toan
            switch(opt)
            {
                case 0: kq = objEntity.a + objEntity.b; break;
                case 1: kq = objEntity.a - objEntity.b; break;
                case 2: kq = objEntity.a * objEntity.b; break;
                case 3: kq = objEntity.a / objEntity.b; break;
            }
            return kq;
        }
    }
}
